package Test;

/**
 * @author Alger
 * @date 2021/9/7  8:22
 */

public class T8 {

    /**
     * 冒泡排序法
     * @param args
     */
    public static void main(String[] args) {
        int a[]={1,2,3,4,5};
        for (int i = 0; i < a.length-1; i++) {
            for (int j = 0; j < a.length-i-1; j++) {
                int temp;
                if (a[j]<a[j+1]){
                    temp=a[j+1];
                    a[j+1]=a[j];
                    a[j]=temp;
                }
            }
        }
        for (int i = 0; i < a.length; i++) {
            System.out.print(a[i]);
        }
    }

}
